package com.sneakxy.cloudbase.platform.bean;

import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;

import com.sneakxy.mybatis.commons.annotations.Table;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 
 * @author 潜行的青衣
 * @see
 */
@Data
@Table("t_mb4j_role_perm")
@EqualsAndHashCode(callSuper = false)
public class RolePerm extends BaseEntity<RolePermId> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7034327916617113867L;
	@Id
	private RolePermId id;

	public RolePerm() {}
	
	public RolePerm(RolePermId id) {
		this.id = id;
		this.isNew = true;
	}
	
	public RolePerm(String roleId, String permId) {
		this(new RolePermId(roleId, permId));
	}
	
	@Transient
	private boolean isNew;

	/* (non-Javadoc)
	 * @see com.sneakxy.cloudbase.base.bean.BaseEntity#isNew()
	 */
	@Override
	public boolean isNew() {
		return isNew || super.isNew();
	}

	/**
	 * @param isNew the isNew to set
	 */
	public void setNew(boolean isNew) {
		this.isNew = isNew;
	}
	
}
